#ifndef Player_h
#define Player_h

#include "Sound.h"
#include "Tagger.h"

//TO WIKI
/*
 *
 *  The player should encapsulate all variables and methods that affect the player (obvius!)
 *  this does not include tagger variables (like clips or ammo) should be in tagger. (captain obvius again!)
 *  
 *  The control of ammunition deserves a special mention. The starting ammunition asociated to
 *  a certain kind of tagger depends on the tagger
 *  but the total of ammunition carried at any moment depends on the player
 *  So the nClips in the player should be set at the start of the game to the total clips for the tagger
 *  and decresed or incresed in the player class from there
 *  
 *  In the future different kinds of players (roles) should be available
 *  those roles should be children of player and override only the needed configuration
 */
class Player
{
public:


  //the tagger associated to that player
  Tagger *equipedTagger;
  Sound *sound;
  bool friendlyFire; //maybe friendly fire should be a variable of the tagger 
  //we should consider making a general class for them

  //respawn and heal variables
  bool anyKindOfRespawn;
  bool hasDeathSound; 
  uint8_t respawnDelay; //seconds to respawn
  bool alliedRespawn; //other players could "resucitate" the player if dead //IMPROVEMENT
  bool baseRespawn; //the player could resucitate if he walked to a base his team owned
  						  //and shooted the base sensor while dead //IMPROVEMENT
  bool alliedHeal; //other players could heal the player if NOT YET dead //IMPROVEMENT
  bool baseHeal;

  //lifepoint varialbes
  uint8_t maxLifePoints; //te maximum ammount of life points for that player
  uint8_t startingLifePoints; //the life points at the Moment of setup
  uint8_t lifePoints; //the current number of life points
  bool isAlive;
  
  //timing variables
  uint8_t hitResponseTime; //milis *10
  unsigned long wakeUpMoment;
  unsigned long reloadMoment;
  unsigned long respawnMoment;

  //ID varaibles
  uint8_t team; //do not use team 0 because 0 starts commands
  uint8_t number; //starting by 0 number of the player inside the team
  uint8_t nClips; //current number of clips that player is carring

  //methods
  void begin(Sound & sound,Tagger & tagger);
  void hurt(uint8_t attackingDamage, uint8_t attackingPlayer, uint8_t attackingTeam);
  void heal(uint8_t lifePoints);
  void startRespawn();
  void endRespawn();
  void refreshStatus();
  void startReload();
  void endReload();
};

//TO WIKI
// --- var: maxlifepoints ---
//if we want to simmulate players that can grow over his max life points 
//(increased armor, mutants, super powers) 
//we can just make that limit higer than the player starting life

// --- var: hitresponsetime ---
//(we could increase that time when the player has less life!)

// --- var: nClips ---
//what whould happen once the player carries two different taggers?
//cases:
//two taggers that share ammo
//two taggers that do not share ammo
#endif







